package offer;

public class offer_0021 {
    public int[] exchange(int[] nums) {
        int len=nums.length;
        if(len==0) return nums;
        int[] result=new int[len];
        int left=0;
        int right=len-1;
        for(int i=0;i<len;++i){
            if(nums[i]%2==0){
                result[right]=nums[i];
                right--;
            }
            else{
                result[left]=nums[i];
                left++;
            }
        }
        return result;
    }
}
